package com.itheima.Client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class MyThread extends Thread {

    private Socket socket;

    public MyThread(Socket socket) {
        this.socket = socket;
    }
    @Override
    public void run() {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        String s1 = null;

        while (true) {
            try {
                s1 = br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            System.out.println(s1);
        }
    }
}
